home *** CD-ROM | disk | FTP | other *** search
/ Aminet 52 / Aminet 52 (2002)(GTI - Schatztruhe)[!][Dec 2002].iso / Aminet / game / think / AmiChess.lha / AmiChess / src / solve.c < prev    next >
C/C++ Source or Header  |  2002-10-31  |  767b  |  43 lines

  1. #include <clib/alib_protos.h>
  2. #include <stdio.h>
  3. #include <string.h>
  4. #include "common.h"
  5.  
  6. void Solve(char *file)
  7. {
  8. short total,correct,found;
  9. long TotalNodes;
  10. char *p;
  11. total=correct=0;
  12. TotalNodes=0;
  13. SET(flags,SOLVE); 
  14. while(ReadEPDFile(file,0))
  15.     {
  16.     NewPosition();
  17.     total++;
  18.     DoMethod(mui_app,MUIM_Chess_ShowBoard);
  19.     Iterate();
  20.     TotalNodes+=NodeCnt+QuiesCnt;
  21.     p=solution;
  22.     found=false;
  23.     while(*p)
  24.         {
  25.         if(!strncmp(p,SANmv,strlen(SANmv)))
  26.             {
  27.             correct++;
  28.             found=true;
  29.             break;
  30.             }
  31.         while(*p!=' ' && *p) p++;
  32.         while(*p==' ' && *p) p++;
  33.         }
  34.     printf("%s : ",id);
  35.     printf(found?"Correct:  " : "Incorrect:  ");
  36.     printf("%s %s\n",SANmv,solution);
  37.     printf("Correct=%d Total=%d\n",correct,total);
  38.     }
  39. printf("\nTotal nodes = %ld\n",TotalNodes);
  40. CLEAR(flags,SOLVE);
  41. }
  42.  
  43.